package com.borko.healthcare.persistence.hibernate.dao;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.borko.healthcare.entities.beans.NotificationBean;
import com.borko.healthcare.entities.interfaces.Notification;

public class NotificationDAOImpl extends HibernateDaoSupport implements NotificationDAO {
	
	private void createOrUpdate(Notification notification) {
		getHibernateTemplate().saveOrUpdate(notification);
	}

	public void create(Notification notification) {
		createOrUpdate(notification);
	}

	public void delete(Notification notification) {
		getHibernateTemplate().delete(notification);
	}

	public List<Notification> retrive() {
		return getHibernateTemplate().loadAll(Notification.class);
	}

	public void update(Notification notification) {
		getHibernateTemplate().saveOrUpdate(notification);
	}
	
	public Notification getNotification(int id) {
		return getHibernateTemplate().get(NotificationBean.class, id);
	}

}
